home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The X-Philes (2nd Revision)
/
The X-Philes Number 1 (1995).iso
/
xphiles
/
hp48hor2
/
ssqr.src
< prev
next >
Wrap
Text File
|
1994-01-04
|
658b
|
28 lines
%%HP: T(3)A(D)F(.);
@ SSQR, Simplifies SQuare Roots of integers, by Joe Horn
@ Input: positive integer (NOT its square root!).
@ Output: Square root of that integer in simplified algebraic form.
@ Requires the FCTR.LIB library, available on GD8.
IF DUP 1 >
THEN RCLF SWAP -2 SF -3 CF DUP 1 \-> n
\<< Factor OBJ\-> 1 SWAP
START
IF DUP2 SAME
THEN 'n' STO* DROP 1
ELSE DROP
END
NEXT n SWAP
IF DUP 1 ==
THEN SWAP
END OVER SQ /
IF DUP 1 >
THEN '\v/X' { X } ROT + \|vMATCH DROP
IF OVER 1 ==
THEN SWAP DROP
ELSE *
END
ELSE DROP
END SWAP STOF
\>>
END